1. Technical Field
The present invention relates to an improved data processing system. In particular, the present invention relates to processing program annotations in a data processing system. Still more particularly, the present invention relates to incrementally processing program annotations by changing the program's source, doclet, and semantic model.
2. Description of Related Art
In modern development environment, programmers may use annotations declared in a source program to generate auxiliary artifacts or files that perform services. Many common services, including home, remote interfaces and deployment descriptors of an enterprise Java™ Bean, can be automatically generated by a development tool or at run time using annotations.
In most development environments, an annotation is a comment declared in a source program that is preceded with a ‘@’ symbol. By using annotations, metadata may be associated with program elements such as classes, methods, fields, parameters, local variables, and packages. For some programming languages, annotations are compiled and the metadata is stored in the class files. For other programming languages, annotations are interpreted and processed by an annotation processor. Later, the virtual machine or other programs can look for the metadata to determine how to interact with the program elements or change their behavior.
Currently, existing development tools that support annotation processing and artifact generation, such as Ant, an open source product available from the Apache Software Foundation, or XDoclet, an open source product available from XDoclet team of the Apache Software Foundation, process all annotations at once and generate all artifacts at the same time. In order to process all the annotations within a collection of source files and generate artifacts, a programmer has to run a script to start the processing. This slows development productivity, since the programmer has to manually run the script each time to process the annotations.
Other development tools allow programmers to set up automatic scripts that are invoked when a source program is modified. However, the entire collection of source files is processed and all auxiliary artifacts are generated regardless of any source file changes. While mechanisms that process only the changed annotated source files are available, all of the artifacts are still generated even though none of annotations in the source files changes. This greatly affects development performance, because generation of the artifacts is performed regardless of any annotation changes.
Therefore, it would be advantageous to have an improved method and apparatus that incrementally processes annotation changes and generates artifacts for a collection of source files, such that generation of artifacts is processed only when the annotation in the source files changes.